home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-08-13 | 6.9 KB | 278 lines | [TEXT/MPS ] |
- #
- # IMPORTANT: Although you can call the Ivy tool services directly from your script, please use
- # the Ivy "high-level" task library we've provided. Doing so, will ensure compatibility with
- # future versions of Ivy.
- #
- # For more COMPLETE DOCUMENTATION on the Ivy task library see the document titled
- # 'Ivy Task Library documentation.'
- #
-
- tool Ivy signature:'IVYX'
-
- #
- # NOTE : Data types listed as 'symbol' are actually Boolean -the Virtual User does not explicitly
- # support the Boolean type.
-
- begin
-
- # SERVICES TO SET THE CURRENT DIRECTORY AND DELETE FILES
-
- Service "IVSetDirectory"( 'String' ) return 'String';
-
- Service "IVGetDirectory"() return 'String';
-
- Service "IVDeleteImage"( 'String', 'String' ) return 'Symbol';
-
- # SERVICES TO CALCULATE SCREEN IMAGE CHECKSUMS
-
- Service "IVSetChecksumMode"( 'Symbol' ) return 'Symbol';
-
- Service "IVChecksumImage"( 'List' ) return 'String';
-
- # SERVICES TO CAPTURE AND COMPARE 'PICT' SCREEN IMAGAES
-
- Service "IVCreateImage"( 'String', 'String', 'List', 'Symbol', 'List' ) return 'Symbol';
-
- Service "IVCompareImages"( 'String', 'String',
- 'String', 'String',
- 'String', 'String', 'List') return 'Symbol';
-
- Service "IVGetImageInfo"( 'String', 'String' ) return 'list';
-
- # SERVICES COMMON TO ALL VIRTUAL USER 2.0 EXTERNAL TOOLS
-
- Service "Initialize"( 'Undefined' );
-
- Service "Cancel"( 'String' );
-
- Service "GetToolServices"() return 'List';
-
- Service "GetToolVersion"() return 'List';
-
- Service "Poll"( 'String' ) return 'String';
-
- Service "ServiceSupported"( 'String' ) return 'Undefined';
-
- Service "Quit"();
-
- end;
-
-
- #--------------------------------------------------------------------------------------------------
-
-
- # ÏÏÏ INITIALIZATION TASKS
-
-
- task IVInit( location )
- #
- # Use this task to initialize the Ivy external tool. NOTE: You must call this task before using
- # any other Ivy tasks!
- #
- # This task also sets the image information globals(constants). Use these globals to index the
- # list of values returned by the 'IVGetImageInfo' task.
- #
- begin
- global kImageFrame := 1;
- global kIvyVersion := 2;
- global kImageSize := 3;
- global kImageBitMapChecksum := 4;
- global kImageRGBChecksum := 5;
- global kImagePixelCount := 6;
- global kImageBitDepth := 7;
- global kImageTimeStamp := 8;
- global kImageDateStamp := 9;
-
- result := Ivy("Initialize", location); # true launches on the target, false on the host.
-
- return result;
- end;
-
-
- task IVQuit( )
- #
- # Use this task to quit Ivy.
- #
- begin
- return Ivy( "Quit" );
- end;
-
-
- # TASKS TO SET THE CURRENT DIRECTORY AND DELETE FILES
-
-
- task IVSetDirectory( pathName ) # return pathName
- #
- # This task sets Ivy's default file directory. Ivy will place all the images it
- # creates into the default directory; assuming, of course, you did NOT supply a full or partial
- # pathname.
- #
- begin
- result := Ivy( "IVSetDirectory", pathName );
-
- return result;
- end;
-
-
- task IVGetDirectory( ) # return pathName
- #
- # This task returns a string describing the full pathname of Ivy's default directory.
- # See the above description of the task 'IVSetDirectory.'
- #
- begin
- result := Ivy( "IVGetDirectory" );
-
- if ( result[1] <> 0 )
- println "### IVGetDirectory - ", result;
-
- return result;
- end;
-
-
- task IVDeleteImageFile( imageName ) # return boolean
- #
- # This task deletes the file with the name 'imageName' from Ivy's default directory.
- #
- begin
- result := Ivy( "IVDeleteImage", imageName, '' );
-
- if ( result[1] <> -43 and result[1] <> 0 )
- println "### IVDeleteImageFile - ", result;
-
- return result;
- end;
-
-
- # TASKS TO CAPTURE AND COMPARE 'PICT' SCREEN IMAGAES
-
-
- task IVCreateImageFile( imageName, imageRectangle, ignoreRectangles := { } ) # return boolean
- #
- # This task creates an Ivy image file. The file will contain the screen image enclosed
- # by the 'imageRectangle' parameter. You must specify the 'imageRectangle parameter in
- # global coordinates.
- #
- begin
- kDupFNErr := -48;
-
- result := Ivy( "IVCreateImage", imageName, imageName, imageRectangle, true, ignoreRectangles );
-
- if ( result[1] = kDupFNErr or result[1] = -1 )
- begin
- Ivy( "IVDeleteImage", imageName, '' );
- result := Ivy( "IVCreateImage", imageName, imageName, imageRectangle, true, ignoreRectangles );
- end;
-
- if ( result[1] <> 0 )
- println "### IVCreateImageFile - ", result;
-
- return result;
- end;
-
-
- task IVCreateTempImage ( tTempName, imageRectangle )
- #
- # This task is NOT supported, so please do not use it!
- #
- begin
- tFileName := tTempName;
- tTempName := tTempName + NumToStr( random( 1, 32767 ), 16 );
- kDupFNErr := -48;
-
- result := IVCreateImageFile( tTempName, imageRectangle );
- while ( result[1] = kDupFNErr )
- begin
- tTempName := tFileName + NumToStr( random(1, 32767 ), 16 );
- result := IVCreateImageFile( tTempName, imageRectangle );
- end;
-
- if ( result[1] <> 0 )
- println "### IVCreateTempImage - ", result;
- else
- result := result + { tTempName };
-
- return result;
- end;
-
-
- task IVCompareImageFiles( firstImage, secondImage, resultImage, ignoreRectangles := { } ) # return boolean
- #
- # This task compares two images and hilites any differences in a new image.
- # See above for a description of the 'ignoreRectangles' parameter. The 'resultImage'
- # parameter is optional; if the task caller supplies it, the task will create a new image
- # hiliting the differences between the two source images.
- #
- begin
- result := Ivy( "IVCompareImages", firstImage, firstImage,
- secondImage, secondImage,
- resultImage, resultImage, ignoreRectangles );
-
- if ( result[1] <> 0 )
- println "### IVCompareImageFiles - ", result;
-
- return result;
- end;
-
-
- task IVGetImageInfo( imageFile, imageName := '' ) # return a list of values
- #
- # This task returns the following list of values: a rectangle, the bit depth of the image,
- # the size of the image in bytes, the unsigned 32 bit checksum of the image, and the
- # date the image was created.
- #
- begin
- result := Ivy( "IVGetImageInfo", imageFile, imageName );
-
- if ( result[1] <> 0 )
- println "### IVGetImageInfo - ", result;
-
- return result;
- end;
-
-
- # TASKS TO CALCULATE SCREEN IMAGE CHECKSUMS
-
-
- task IVSetChecksumMode( RGBFlag )
- begin
- result := Ivy( "IVSetChecksumMode", RGBFlag );
-
- if ( result[1] <> 0 )
- println "### IVSetChecksumMode - ", result;
-
- return result;
- end;
-
-
- task IVChecksumRectangle( imageRectangle ) # return a string representing a 32 bit unsigned integer
- #
- # This task performs a simple checksum on an image.
- #
- begin
- result := Ivy( "IVChecksumImage", imageRectangle );
-
- if ( result[1] <> 0 )
- println "### IVChecksumRectangle - ", result;
-
- return result;
- end;
-
-
- task IVCreateChecksumFile( imageName, imageRectangle ) # return a string representing a 32 bit unsigned integer
- #
- # This task creates a new file named imageName and stores the 32 bit checksum value in the
- # resource fork of the file; in a type 'IVYC' resource.
- #
- begin
- result := Ivy( "IVCreateImage", imageName, imageName, imageRectangle, false, {} );
-
- if ( result[1] <> 0 )
- println "### IVCreateChecksumFile - ", result;
-
- return result;
- end;
-
-
-
-
-